<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>地址栏</title>
    <script>
        function f1(){
            // 取值
            console.log(window.location);
            console.log(window.location.href);

            // 赋值,为地址栏重新赋予了一个值
            // 相当于页面跳转
            // location = "34-练习.html";
            location.href = "34-练习.html";
        }

        function f2(){
            console.log("打开该窗口的窗口:"+window.opener);
            console.log(window.opener.location);
            console.log(window.opener.location.href);

            opener.location.href = "35-消息框.html";
        }

        function f3(){
            console.log(window.parent);
            console.log(parent.location);
            console.log(parent.location.href);

            parent.location.href = "31-事件冒泡.html";
        }
    </script>
</head>
<body>
<button onclick="f1()">获取当前窗口地址栏</button><br>
<button onclick="f2()">获取打开该窗口的窗口的地址栏</button><br>
<button onclick="f3()">获取父窗口地址栏</button>
</body>
</html>